/* ******* White Rotations ******** */

void w1(struct aCube * cube) {
	w1c( cube );
	w1e( cube );
}

void w2(struct aCube * cube) {
	w2c( cube );
	w2e( cube );
}

void w3(struct aCube * cube) {
	w3c( cube );
	w3e( cube );
}

void w1c(struct aCube * cube) {
  
	short temp = cube[C1].o;
	cube[C1].o = cube[C3].g;
	cube[C3].g = cube[C4].r;
	cube[C4].r = cube[C2].b;
	cube[C2].b = temp;

	temp = cube[C1].g;
	cube[C1].g = cube[C3].r;
	cube[C3].r = cube[C4].b;
	cube[C4].b = cube[C2].o;
	cube[C2].o = temp;

	temp = cube[C1].w;
	cube[C1].w = cube[C3].w;
	cube[C3].w = cube[C4].w;
	cube[C4].w = cube[C2].w;
	cube[C2].w = temp;

        temp = cube[C1].pos;
        cube[C1].pos = cube[C3].pos;
        cube[C3].pos = cube[C4].pos;
        cube[C4].pos = cube[C2].pos;
        cube[C2].pos = temp;
}

void w1e(struct aCube * cube) {

	short temp = cube[E9].o;
	cube[E9].o = cube[E12].g;
	cube[E12].g = cube[E11].r;
	cube[E11].r = cube[E10].b;
	cube[E10].b = temp;

	temp = cube[E9].w;
	cube[E9].w = cube[E12].w;
	cube[E12].w = cube[E11].w;
	cube[E11].w = cube[E10].w;
	cube[E10].w = temp;

	temp = cube[E9].pos;
        cube[E9].pos = cube[E12].pos;
        cube[E12].pos = cube[E11].pos;
        cube[E11].pos = cube[E10].pos;
        cube[E10].pos = temp;
}

void w2c(struct aCube * cube) {

	short temp = cube[C1].o;
	cube[C1].o = cube[C4].r;
	cube[C4].r = temp; 
	temp = cube[C1].g;
	cube[C1].g = cube[C4].b;
	cube[C4].b = temp;

	temp = cube[C2].b;
	cube[C2].b = cube[C3].g;
	cube[C3].g = temp;
	temp = cube[C2].o;
	cube[C2].o = cube[C3].r;
	cube[C3].r = temp;

	temp = cube[C1].w;
	cube[C1].w = cube[C4].w;
	cube[C4].w = temp;
	temp = cube[C2].w;
	cube[C2].w = cube[C3].w;
	cube[C3].w = temp;

        temp = cube[C1].pos;
        cube[C1].pos = cube[C4].pos;
	cube[C4].pos = temp;
        temp = cube[C2].pos;
        cube[C2].pos = cube[C3].pos;
        cube[C3].pos = temp;
}

void w2e(struct aCube * cube) {

	short temp = cube[E9].o;
	cube[E9].o = cube[E11].r;
	cube[E11].r = temp;
	temp = cube[E12].g; 
	cube[E12].g = cube[E10].b;
	cube[E10].b = temp;

	temp = cube[E9].w;
	cube[E9].w = cube[E11].w;
	cube[E11].w = temp;
	temp = cube[E12].w;
	cube[E12].w = cube[E10].w;
	cube[E10].w = temp;

        temp = cube[E9].pos;
        cube[E9].pos = cube[E11].pos;
        cube[E11].pos = temp;
        temp = cube[E12].pos;
        cube[E12].pos = cube[E10].pos;
        cube[E10].pos = temp;
}



void w3c(struct aCube * cube) {

	short temp = cube[C1].o;
	cube[C1].o = cube[C2].b;
	cube[C2].b = cube[C4].r;
	cube[C4].r = cube[C3].g;
	cube[C3].g = temp; 

	temp = cube[C1].g;
	cube[C1].g = cube[C2].o;
	cube[C2].o = cube[C4].b;
	cube[C4].b = cube[C3].r;
	cube[C3].r = temp;

	temp = cube[C1].w;
	cube[C1].w = cube[C2].w;
	cube[C2].w = cube[C4].w;
	cube[C4].w = cube[C3].w;
	cube[C3].w = temp;

        temp = cube[C1].pos;
        cube[C1].pos = cube[C2].pos;
        cube[C2].pos = cube[C4].pos;
        cube[C4].pos = cube[C3].pos;
        cube[C3].pos = temp;
}

void w3e(struct aCube * cube) {

	short temp  = cube[E9].o;
	cube[E9].o  = cube[E10].b;
	cube[E10].b = cube[E11].r;
	cube[E11].r = cube[E12].g;
	cube[E12].g = temp;

	temp = cube[E9].w;
	cube[E9].w  = cube[E10].w;
	cube[E10].w = cube[E11].w;
	cube[E11].w = cube[E12].w;
	cube[E12].w = temp;

        temp = cube[E9].pos;
        cube[E9].pos = cube[E10].pos;
        cube[E10].pos = cube[E11].pos;
        cube[E11].pos = cube[E12].pos;
        cube[E12].pos = temp;
}
